////////////////////////////////////////////////////////////////////////////////
// The following FIT Protocol software provided may be used with FIT protocol
// devices only and remains the copyrighted property of Dynastream Innovations Inc.
// The software is being provided on an "as-is" basis and as an accommodation,
// and therefore all warranties, representations, or guarantees of any kind
// (whether express, implied or statutory) including, without limitation,
// warranties of merchantability, non-infringement, or fitness for a particular
// purpose, are specifically disclaimed.
//
// Copyright 2008 Dynastream Innovations Inc.
////////////////////////////////////////////////////////////////////////////////
// ****WARNING****  This file is auto-generated!  Do NOT edit this file.
// Profile Version = 1.50Release
// Tag = $Name: AKW1_500 $
////////////////////////////////////////////////////////////////////////////////


#include "fit_accumulator.hpp"

namespace fit
{

FIT_UINT32 Accumulator::Accumulate(const FIT_UINT16 mesgNum, const FIT_UINT8 fieldNum, const FIT_UINT8 componentNum, const FIT_UINT32 value, const FIT_UINT8 bits)
{
   int i;

   for (i = 0; i < (int)fields.size(); i++)
   {
      if ((fields[i].mesgNum == mesgNum) && (fields[i].fieldNum == fieldNum) && (fields[i].componentNum == componentNum))
         break;
   }

   if (i == (int)fields.size()) {
      fields.push_back(AccumulatedField(mesgNum, fieldNum, componentNum));
   }

   return fields[i].Accumulate(value, bits);
}

} // namespace fit
